package com.woniu.command.appcommand;

import com.woniu.command.Command;
import com.woniu.command.handler.AppCommandHandler;
import com.woniu.outlet.po.ApplicationDetail;
import com.woniu.util.ApplicationContextHolder;

public class AddAppCommand implements Command<ApplicationDetail> {
    private AppCommandHandler handler;

    public AddAppCommand ( ) {
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(AppCommandHandler.class);
    }

    @Override
    public void execute (ApplicationDetail applicationDetail) {
        applicationDetail.setSpare1("未领取");
        handler.addApplication(applicationDetail);
    }
}
